namespace CGF
{
    public partial class PanelMyExpo : UIComponentBase, IAwake<UILayer, bool>, IDestroy
    {
        public static void Open()
        {
            UIManagerComponent.instance.OpenUI<PanelMyExpo>(UILayer.Normal, RootComponent.instance, false);
        }

        public static void Close()
        {
            UIManagerComponent.instance.CloseUI<PanelMyExpo>();
        }

        public async void Awake(UILayer layer, bool isFloat)
        {
            await SpawnPrefab("Prefabs/GameUI/PanelMyExpo", layer, isFloat);
			BindProperties(transform);
            
            BtnBack.SetClick(Close);
            
            // "id":359111574318747648,
            // "user_id":359060771344224256,
            // "state":1,
            // "end_time":"2025-09-29T04:50:27.956-03:00",
            // "created_at":"2025-09-17T12:01:11.289-03:00"
            string api = "/v1/reward/report";
            string listKey = "reports";
            Table.Column[] columns =
            {
                (cell, data) => TimeHelper.Parse2Date(data["created_at"].ToString(), false),
                (cell, data) => data["id"].ToString(),
                (cell, data) => I18N_view,
            };
            Table.GetComponent<Table>().ReqData(api, listKey, columns, null, null, data =>
            {
                PanelMyExpoDetail.Open(data);
            });
        }

        public override void OnDestroy()
        {
            base.OnDestroy();
        }

    }
}
